icon-shadow: black 0px 2px 2px;
}
+.panel-menu {
+ -boxpointer-gap: 4px
+}
+
/* The rounded panel corners we draw don't
* support transitions, so disable transitions
* for the buttons at the left/right edges
if (St.Widget.get_default_direction() == St.TextDirection.RTL)
side = St.Side.RIGHT;
- PopupMenu.PopupMenu.prototype._init.call(this, source.actor, 0.5, side, 0);
+ PopupMenu.PopupMenu.prototype._init.call(this, source.actor, 0.5, side);
// We want to keep the item hovered while the menu is up
this.blockSourceEvents = true;
this.bin.allocate(childBox, flags);
if (this._sourceActor && this._sourceActor.mapped)
- this._reposition(this._sourceActor, this._gap, this._alignment);
+ this._reposition(this._sourceActor, this._alignment);
},
_drawBorder: function(area) {
cr.stroke();
},
- setPosition: function(sourceActor, gap, alignment) {
+ setPosition: function(sourceActor, alignment) {
// We need to show it now to force an allocation,
// so that we can query the correct size.
this.actor.show();
this._sourceActor = sourceActor;
- this._gap = gap;
this._alignment = alignment;
- this._reposition(sourceActor, gap, alignment);
+ this._reposition(sourceActor, alignment);
},
- _reposition: function(sourceActor, gap, alignment) {
+ _reposition: function(sourceActor, alignment) {
// Position correctly relative to the sourceActor
let sourceNode = sourceActor.get_theme_node();
let sourceContentBox = sourceNode.get_content_box(sourceActor.get_allocation_box());
let margin = (4 * borderRadius + borderWidth + arrowBase);
let halfMargin = margin / 2;
+ let themeNode = this.actor.get_theme_node();
+ let gap = themeNode.get_length('-boxpointer-gap');
+
let resX, resY;
switch (this._arrowSide) {
this.actor._delegate = this;
this.actor.connect('button-press-event', Lang.bind(this, this._onButtonPress));
this.actor.connect('key-press-event', Lang.bind(this, this._onSourceKeyPress));
- this.menu = new PopupMenu.PopupMenu(this.actor, menuAlignment, St.Side.TOP, 0);
+ this.menu = new PopupMenu.PopupMenu(this.actor, menuAlignment, St.Side.TOP);
+ this.menu.actor.add_style_class_name('panel-menu');
this.menu.connect('open-state-changed', Lang.bind(this, this._onOpenStateChanged));
this.menu.actor.connect('key-press-event', Lang.bind(this, this._onMenuKeyPress));
Main.chrome.addActor(this.menu.actor, { affectsStruts: false });
PopupMenu.prototype = {
__proto__: PopupMenuBase.prototype,
- _init: function(sourceActor, alignment, arrowSide, gap) {
+ _init: function(sourceActor, alignment, arrowSide) {
PopupMenuBase.prototype._init.call (this, sourceActor, 'popup-menu-content');
this._alignment = alignment;
this._arrowSide = arrowSide;
- this._gap = gap;
this._boxPointer = new BoxPointer.BoxPointer(arrowSide,
{ x_fill: true,
this.isOpen = true;
- this._boxPointer.setPosition(this.sourceActor, this._gap, this._alignment);
+ this._boxPointer.setPosition(this.sourceActor, this._alignment);
this._boxPointer.show(animate);
this.emit('open-state-changed', true);